package org.lilred.ui.theme;

import net.rim.device.api.ui.Graphics;

public interface Texture {
	public void paint(int width, int height, Graphics g);
	
	public static final Texture GLASS = new Texture() {
		public void paint(int width, int height, Graphics g) {
			int startAlpha = g.getGlobalAlpha();
			g.setColor(0xFFFFFF);
			g.fillRect(0, 0, width, height / 2);
			for (int i = 0; i < height / 2; i++) {
				//Alpha should be 255 at bottom and 0 at center.
				g.setGlobalAlpha((int) (1.0 * startAlpha * i / height / 2));
				g.drawLine(0, i + height / 2, width, i + height / 2);
			}
		}
	};
	
	public static final Texture HIGHLIGHT_HARD = new Texture() {
		public void paint(int width, int height, Graphics g) {
			int startAlpha = g.getGlobalAlpha();
			for (int i = 0; i < height; i++) {
				g.setColor(0xFFFFFF);
				int alpha = (int) (1.0 * i / height * startAlpha);
				g.setGlobalAlpha(alpha);
				g.drawLine(0, height - i, width, height - i);
			}
		}
	};
	
	public static final Texture HIGHLIGHT_SOFT = new Texture() {
		public void paint(int width, int height, Graphics g) {
			int startAlpha = g.getGlobalAlpha();
			for (int i = 0; i < height; i++) {
				g.setColor(0xFFFFFF);
				int alpha = (int) (1.0 * i / height * startAlpha / 2);
				g.setGlobalAlpha(alpha);
				g.drawLine(0, height - i, width, height - i);
			}
		}
	};
	
	public static final Texture INSET_HARD = new Texture() {
		public void paint(int width, int height, Graphics g) {
			int startAlpha = g.getGlobalAlpha();
			for (int i = 0; i < height; i++) {
				g.setColor(0xFFFFFF);
				int alpha = (int) (1.0 * i / height * startAlpha);
				g.setGlobalAlpha(alpha);
				g.drawLine(0, i, width, i);
			}
		}		
	};
	
	public static final Texture INSET_SOFT = new Texture() {
		public void paint(int width, int height, Graphics g) {
			int startAlpha = g.getGlobalAlpha();
			for (int i = 0; i < height; i++) {
				g.setColor(0xFFFFFF);
				int alpha = (int) (1.0 * i / height * startAlpha);
				g.setGlobalAlpha(alpha);
				g.drawLine(0, i, width, i);
			}
		}
	};
}
